package com.tom.redisapplication.controller;

import com.tom.redisapplication.delay.doubledelete.anno.ClearAndReloadCache;
import com.tom.redisapplication.model.entity.BaseResponse;
import com.tom.redisapplication.model.User;
import com.tom.redisapplication.service.UserService;
import lombok.Setter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author zx
 * @date 2024年12月25日 9:56
 */
@RestController
@RequestMapping("/user")
public class UserController {

    @Setter(onMethod_ = @Autowired)
    private UserService userService;



    @PostMapping("/updateUserData")
    @ClearAndReloadCache(name="get method")
    public BaseResponse<String> updateUserData(@RequestBody User user){
        return userService.updateUserData(user)?BaseResponse.success("修改成功"):BaseResponse.fail("失败");
    }


}
